import qs from 'qs'
import service from './fetch.js'

export const typewww = 'application/x-www-form-urlencoded; charset=UTF-8'

export default {
  // ranking
  getSubject(params) {
    return service(`/subject`, params, 'GET')
  },
  getCollegesLevel(params) {
    return service(`/collegesLevel`, params, 'GET')
  },
  getArea(params) {
    return service(`/area`, params, 'GET')
  },
  getBigMajorCategory(params) {
    return service(`/bigMajorCategory`, params, 'GET')
  },
  getSmallMajorCategory(params) {
    return service(`/smallMajorCategory`, params, 'GET')
  },
  getMajor(params) {
    return service(`/major`, params, 'GET')
  },
  getDepartment(params) {
    return service(`/department`, params, 'GET')
  },
  getCollegeHomepage(params) {
    return service(`/collegeHomepage`, params, 'GET')
  },
  getCollegeBKRank(params) {
    return service(`/collegeBKRank`, params, 'GET')
  },
  getCollegeIndepRank(params) {
    return service(`/collegeIndepRank`, params, 'GET')
  },
  getCollegeMBRank(params) {
    return service(`/collegeMBRank`, params, 'GET')
  },
  getCollegeGZRank(params) {
    return service(`/collegeGZRank`, params, 'GET')
  },
  getCollegeZYRank(params) {
    return service(`/collegeZYRank`, params, 'GET')
  },
  getCollegeZYRankZy(params) {
    return service(`/collegeZYRankZy`, params, 'GET')
  },
  getCollegeRKZYRank(params) {
    return service(`/collegeRKZYRank`, params, 'GET')
  },

  // login
  signin(params) {
    return service(`/api/person/login`, qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
  },
  signup(params) {
    return service(`/api/person/register/new`, qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
  },
  accountSignin(params) {
    return service(`/api/unicom/login`, qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
  },
  getCaptcha(params) {
    return service(`/api/person/captcha`, qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
  },
  getUserInfo(params) {
    return service(`/api/app/person/info`, qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
  },
  getCategory(params) {
    return service(`/api/app/category`, qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
  },
  getArtCategory(params) {
    return service(`/api/app/art/category`, qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
  },
  getShoolResult(params) {
    return service(`/api/app/school/search`, qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
  },
  getResultByCategory(params) {
    return service(`/api/app/search`, qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
  },
  getRankAdvice(params) {
    return service(`/api/person/rank/advice`, qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
  },
  getScoreAdvice(params) {
    return service(`/api/person/score/advice`, qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
  },
  saveScoreRank(params) {
    return service(`/api/person/scoreRank/save`, qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
  },
  getOrderList(params) {
    return service(`/api/order/paid/list`, qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
  },
  payReport(params) {
    return service(`/api/mini/unifiedorder`, qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
  },
  getHeightSchool(params) {
    return service(`/api/highschool/list`, qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
  },
  saveUserinfo(params) {
    return service(`/api/person/info/save`, qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
  },
  saveArtScoreRank(params) {
    return service(`/api/app/info/art/save`, qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
  },
  saveOrder(params) {
    return service(`/api/order/add`, qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
  },
  regPerson(params) {
    return service(`/api/person/register/no`, qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
  },
  createAccount(params) {
    return service(`/api/unicom/create`, qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
  },
  getNewsAll(params) {
    return service(`/api/news/page`, params, 'GET', 'main')
  },
  getNewsDetail(params) {
    return service(`/api/news/info`, params, 'GET', 'main')
  },
  alipayWap(params) {
    return service(`/api/order/pay/alipay/wap`, qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
  },
  orderByTrandeNo(params) {
    return service(`/api/order/query/outtradeno`, qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
  },
  orderByOrderId(params) {
    return service(`/api/order/query`, qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
  },
  getOrderNotify(params) {
    return service(`/api/order/last`, params, 'GET', 'main')
  },
  saveOrderByWx(params) {
    return service(`/api/order/pay/wx/jsapi`, qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
  },
  getOpenIdByCode(params) {
    return service(`/api/wx/openid/code`, qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
  },
  saveOrderByWxH5(params) {
    return service(`/api/order/pay/wx/h5`, qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
  },
  getChangeCount(params) {
    return service(`/api/person/changecount`, params, 'GET', 'main')
  },
  updateChangeCount(params) {
    return service(`/api/person/changecount/update`, qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
  },
  updateSubjectCount(params) {
    return service(`/api/person/subjectcount/update`, qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
  },
  updateSubjectAndChangeCount(params) {
    return service(`/api/person/changecountandsubjectcount`, qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
  },
  saveResult(params) {
    return service('/api/person/saveSearchInfo', qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
  },
  getResult(params) {
    return service('/api/person/getSearchInfo', qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
  },
  checkValidUser() {
    return service('/api/person/checkValidUser', null, 'POST', 'main', { 'Content-Type': typewww })
  },
  //宁波市必需购买VIP，验证
  checkNingBoUser() {
    return service('/api/person/checkNingBoUser', null, 'GET', 'main')
  },
  //  
  getCategoryList(){
    return service('/api/category/list', null, 'GET', 'main')
  },
  getVersion(){
    return service('/api/version', null, 'GET', 'main')
  },

  setScoreRank(params) {
    if (params.examType == 1) {
      return service(`/api/person/scoreRank/save`, qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
    } else if (params.examType == 2) {
      return service(`/api/app/info/art/save`, qs.stringify(params), 'POST', 'main', { 'Content-Type': typewww })
    }
  },
}
